package com.ygp.wait;

import com.ygp.utils.Sleeper;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.locks.LockSupport;

/**
 * <Description> <br>
 *
 * @author linmiaolai@sanyygp.com<br>
 * @version 1.0<br>
 * @date 2021/11/12 <br>
 */

@Slf4j(topic = "c.parkUnpark")
public class TestParkUnpark {

    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            log.debug("start.....");
            Sleeper.sleep(1);
            log.debug("park....");
            LockSupport.park();
            log.debug("resume....");
        }, "t1");

        t1.start();
        Sleeper.sleep(2);
        log.debug("unpark....");
        LockSupport.unpark(t1);
    }
}
